import { Poem } from 'src/modules/poem/entities/poem.entity';
import {
  Column,
  CreateDateColumn,
  Entity,
  OneToMany,
  PrimaryGeneratedColumn,
  UpdateDateColumn,
} from 'typeorm';

@Entity()
export class Poet {
  @PrimaryGeneratedColumn()
  id: number;

  @Column()
  name: string;

  @Column({ nullable: true })
  birthday: Date;

  @Column({ nullable: true })
  deadday: Date;

  @Column({ nullable: true })
  description: string; //简介

  @Column({ nullable: true })
  life: string; //生平

  @Column({ nullable: true })
  gender: number; //性别

  @Column({ nullable: true })
  dynasty: string; //朝代

  @Column({ nullable: true })
  wiki: string; //国籍

  @CreateDateColumn()
  createTime: Date;

  @UpdateDateColumn()
  updateTime: Date;

  @OneToMany(() => Poem, (poem) => poem.poet)
  poems: Poem[];
}
